package com.cardone.platform.usercenter.service;

import java.util.List;

import lombok.Getter;
import lombok.Setter;

import com.cardone.common.dto.PaginationDto;
import com.cardone.context.ContextHolder;
import com.cardone.platform.usercenter.dao.DepartmentDao;
import com.cardone.platform.usercenter.dto.DepartmentDto;

/**
 * 部门服务
 *
 * @author yaohaitao
 *
 */
@Getter
@Setter
public class DepartmentDefaultService implements DepartmentService {
	@Override
	public int deleteByIds(final DepartmentDto deleteDepartment) {
		return ContextHolder.getBean(DepartmentDao.class).deleteByIds(deleteDepartment);
	}

	@Override
	public <P> P findByCodeOrId(final Class<P> mappedClass, final DepartmentDto findDepartment) {
		return ContextHolder.getBean(DepartmentDao.class).findByCodeOrId(mappedClass, findDepartment);
	}

	@Override
	public <P> P findById(final Class<P> mappedClass, final DepartmentDto findDepartment) {
		return ContextHolder.getBean(DepartmentDao.class).findById(mappedClass, findDepartment);
	}

	@Override
	public <P> List<P> findListByLikeCode(final Class<P> mappedClass, final DepartmentDto findListDepartment) {
		return ContextHolder.getBean(DepartmentDao.class).findListByLikeCode(mappedClass, findListDepartment);
	}

	@Override
	public int insertByCode(final DepartmentDto insertDepartment) {
		return ContextHolder.getBean(DepartmentDao.class).insertByCode(insertDepartment);
	}

	@Override
	public <P> PaginationDto<P> paginationByLikeCode(final Class<P> mappedClass, final DepartmentDto paginationDepartment) {
		return ContextHolder.getBean(DepartmentDao.class).paginationByLikeCode(mappedClass, paginationDepartment);
	}

	@Override
	public Integer readByCodeNqIdForCount(final DepartmentDto readDepartment) {
		return ContextHolder.getBean(DepartmentDao.class).readByCodeNqIdForCount(readDepartment);
	}

	@Override
	public <P> P saveByIdOrCode(final Class<P> mappedClass, final DepartmentDto saveDepartment) {
		return ContextHolder.getBean(DepartmentDao.class).saveByIdOrCode(mappedClass, saveDepartment);
	}

	@Override
	public int updateByCode(final DepartmentDto updateDepartment) {
		return ContextHolder.getBean(DepartmentDao.class).updateByCode(updateDepartment);
	}
}